<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
    <style>
        .class1{
            width: 90px;
            height: 30px;
            background-color: white;
            border: 1px solid skyblue;
        }
        .class2{
            width: 90px;
            height: 30px;
            background-color: red;
            border: 0;
        }
    </style>
</head>
<body>
<div id="app">
    <button :class="myclass.myclass1" @click="mysrc" >教父</button>
    <button :class="myclass.myclass2" @click="mysrc">阿甘正传</button>
    <button :class="myclass.myclass3" @click="mysrc">楚门的世界</button>
    <button :class="myclass.myclass4" @click="mysrc">盗梦空间</button>
    <hr>
    
    <img :src="src" alt="">
</div>

    

    
</body>
<script>
    var vue =new Vue({
        el:'#app',
        data:{
            myclass:{'myclass1':'class1','myclass2':'class1','myclass3':'class1','myclass4':'class1'},
            src:''
        },
        methods:{
            mysrc(e){
                if(e.target.innerText=='教父'){
                    this.src='../img/xx.png'
                    this.myclass.myclass1='class2'
                    this.myclass.myclass2='class1'
                    this.myclass.myclass3='class1'
                    this.myclass.myclass4='class1'
                }else if(e.target.innerText=='阿甘正传'){
                    this.src='../img/2.png'
                    this.myclass.myclass1='class1'
                    this.myclass.myclass2='class2'
                    this.myclass.myclass3='class1'
                    this.myclass.myclass4='class1'
                }else if(e.target.innerText=='楚门的世界'){
                    this.src='../img/xx.png'
                    this.myclass.myclass1='class1'
                    this.myclass.myclass2='class1'
                    this.myclass.myclass3='class2'
                    this.myclass.myclass4='class1'
                }
                else{
                    this.src='../img/2.png'
                    this.myclass.myclass1='class1'
                    this.myclass.myclass2='class1'
                    this.myclass.myclass3='class1'
                    this.myclass.myclass4='class2'
                }
                
            }
        }
    })
</script>
</html>